-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #36823 - Create job invocations detail page with main info #839
Conversation
import { selectAPIResponse } from 'foremanReact/redux/API/APISelectors'; | ||
|
||
export const selectItems = state => | ||
selectAPIResponse(state, 'JOB_INVOCATION_KEY') || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since items is used as an object { description, status_label: statusLabel, task } = items;
, the fallback should be an empty object {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, selectAPIResponse
already gives a fallback, so no fallback needed.
export const selectAPIResponse = (state, key) => selectAPIByKey(state, key).response || {};
@@ -232,6 +232,7 @@ class Engine < ::Rails::Engine | |||
caption: N_('Job templates'), | |||
parent: :hosts_menu, | |||
after: :provisioning_templates | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space :)
webpack/JobInvocationDetail/index.js
Outdated
const finished = statusLabel === 'failed' || statusLabel === 'succeeded'; | ||
const autoRefresh = task?.state === 'pending' || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use constants for failed, succeeded, pending
webpack/JobInvocationDetail/index.js
Outdated
const getData = url => | ||
withInterval( | ||
get({ | ||
key: JOB_INVOCATION_KEY, | ||
url, | ||
handleError: () => { | ||
dispatch(stopInterval(JOB_INVOCATION_KEY)); | ||
}, | ||
}), | ||
1000 | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to an actions file
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>{__('Run on:')}</DescriptionListTerm> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should change the text according to if it already ran or if its going to run in the future, can be done in the next pr but would be nice to have some todo note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ssh_user: sshUser, | ||
template_invocations: template, | ||
} = data; | ||
const effectiveUser = ssh ? ssh.effective_user : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When setting an effective user on a job, I dont see its value in the job invocation
9eac59a
to
d7b7cb8
Compare
c07d707
to
6c1f9d2
Compare
@MariaAga Thank you for your review, I've updated the code and changed how I retrieve "effective_user" and some other attributes. |
6c1f9d2
to
fee84c3
Compare
Thanks to Adam's feedback, I've just deleted my unnecessary changes in the |
import { selectAPIResponse } from 'foremanReact/redux/API/APISelectors'; | ||
|
||
export const selectItems = state => | ||
selectAPIResponse(state, 'JOB_INVOCATION_KEY'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JOB_INVOCATION_KEY
should be from JobInvocationConstants
const dateConverted = new Date(startAt); | ||
const dateLocaleFormatted = dateConverted | ||
.toLocaleString(documentLocale(), dateOptions) | ||
.replace(/(\d{4}) /, '$1, '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why have this line? it adds a ,
after the year but in some locales it doesnt make sense to add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to do exactly what you said, but I didn't realize it may be strange in other locales. I'll just delete it
fee84c3
to
81a1fff
Compare
347c92e
to
6dd5986
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
@adamruzicka Can you take a look at the ruby parts?
8de6792
to
8e6a585
Compare
8e6a585
to
16f7d43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nitpick, apart from it lgtm
16f7d43
to
5112090
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
The commit creates a new job invocation detail page (see discussion) which is experimental until finished - you can find it in Lab Features or see
/experimental/job_invocations_detail/${JOB_ID}
. It includes the main information.Update: There is a link on the old detail page to the new one if the experimental labs setting is on.